package com.bytedy.sboot.support.auth;

import org.springframework.security.config.annotation.web.HttpSecurityBuilder;
import org.springframework.security.config.annotation.web.configurers.AbstractAuthenticationFilterConfigurer;
import org.springframework.security.web.util.matcher.AntPathRequestMatcher;
import org.springframework.security.web.util.matcher.RequestMatcher;

/**
 * WebSecurityConfigurer
 *
 * Date: 2024/5/29 18:18
 * Author: ByteDy
 */

public final class UserLoginConfigurer<H extends HttpSecurityBuilder<H>> extends
        AbstractAuthenticationFilterConfigurer<H, UserLoginConfigurer<H>, UserLoginAuthenticationFilter>{

    public UserLoginConfigurer() {
        super(new UserLoginAuthenticationFilter(), "/login");
        // usernameParameter("username");
        // passwordParameter("password");
    }

    @Override
    protected RequestMatcher createLoginProcessingUrlMatcher(String loginProcessingUrl) {
        // return new AntPathRequestMatcher(loginProcessingUrl, "POST");
        return new AntPathRequestMatcher(loginProcessingUrl);
    }

    // @Override
    // public void init(H http) throws Exception {
    //     super.init(http);
    // }
}
